home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / snippets_vol2 / snip_imagescroller.dba < prev    next >
Encoding:
Text File  |  2000-08-20  |  1.1 KB  |  59 lines

  1. `    ------------------------------------------------------------------------
  2. `    ImageScroller                              DarkForge Snippet (20/8/2000)
  3. `    ------------------------------------------------------------------------
  4. `    Scroll around a full-screen zoomed-in image using mouse or cursor keys.
  5. `    Hold down left button for extra scroll speed.
  6.  
  7. sync rate 0
  8. sync on
  9. hide mouse
  10.  
  11. load bitmap "anhk_inside.bmp",1
  12.  
  13. speed=4 : x=0 : y=0
  14.  
  15. do
  16.  
  17.     copy bitmap 1,x,y,x+180,y+120,0,0,0,639,479
  18.  
  19.     if rightkey()=1 or mousemovex()>0
  20.         if mouseclick()=1
  21.             inc x,speed*4
  22.         else
  23.             inc x,speed
  24.         endif
  25.         if x>(640-181) then x=640-181
  26.     endif
  27.  
  28.     if leftkey()=1 or mousemovex()<0
  29.         if mouseclick()=1
  30.             dec x,speed*4
  31.         else
  32.             dec x,speed
  33.         endif
  34.         if x<0 then x=0
  35.     endif
  36.  
  37.     if downkey()=1 or mousemovey()>0
  38.         if mouseclick()=1
  39.             inc y,speed*4
  40.         else
  41.             inc y,speed
  42.         endif
  43.         if y>(480-121) then y=480-121
  44.     endif
  45.  
  46.     if upkey()=1 or mousemovey()<0
  47.         if mouseclick()=1
  48.             dec y,speed*4
  49.         else
  50.             dec y,speed
  51.         endif
  52.         if y<0 then y=0
  53.     endif
  54.  
  55.     sync
  56.  
  57. loop
  58.  
  59.